package com.it.controller;

import com.it.entity.admin;
import com.it.service.IAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/admin")
public class HelloController {

    @Autowired
    private IAdminService adminService;

    @GetMapping("/getAll")
    public List<admin> getAll() {
        return adminService.getAll();
    }

    //保存和更新采用json格式传参
    @PostMapping("/save")
    public boolean save(@RequestBody admin admin) {
        return adminService.save(admin);
    }

    @GetMapping("/getById/{id}")
    public admin getById(@PathVariable("id") Integer id) {
        return adminService.getById(id);
    }
}
